import api from '../../fetch/api'
import * as types from '../mutation-types';

// 通用配置
const state = {
    hospitals: [],
}

const actions = {
    getHospitalList({ commit }) {
        api.get_hospital_list().then(res => {
            commit(types.GET_HOSPITAL_LIST, res)
        })
    }
}

const getters = {
    hospitals: state => state.hospitals,
}

const mutations = {
    [types.GET_HOSPITAL_LIST](state, res) {
        state.hospitals = res.data
    },
}

export default {
    state,
    actions,
    getters,
    mutations,
}